#ifndef __CPACKET_H__
#define __CPACKET_H__

#define MAX_BUFFER 10000

class CPacket {
public:
	unsigned __int16	m_nExpecting									;
	unsigned __int16	m_nGotten										;
	unsigned __int16	m_nSent											;


	CPacket()															;

	unsigned __int16	InsertDWORD(unsigned __int32 nVal)				;

	unsigned __int16	InsertWORD(unsigned __int16 nVal)				;
	
	unsigned __int16	InsertBYTE(unsigned __int8 nVal)				;
	
	unsigned __int16	InsertString(const char* lpszString, int nLen)	;
	
	unsigned __int32	GetDWORD(void)									;
	
	unsigned __int16	GetWORD(void)									;
	
	unsigned __int8		GetBYTE(void)									;
	
	unsigned __int8		GetString(char* lpszString)						;

	char*				GetBuffer(void)
	{ return m_szBuf;	}												;
	unsigned __int16	GetLength(void)
	{ return m_nLen;	}												;

	void				Encode(	unsigned __int16 nStart	, 
								unsigned __int16 nLen	)				;
	
	~CPacket()															;
private:
protected:
	char				m_szBuf[MAX_BUFFER]								;
	unsigned __int16	m_nLen											;
	unsigned __int16	m_nPos											;
} ;

#endif
